import { createRouter, createWebHistory, RouterLink } from 'vue-router'
import Home from './components/Home.vue'
import Movie from './components/Movie.vue'
import About from './components/About.vue'
import HelloWorld from './components/HelloWorld.vue'
import Login from './components/Login.vue'
import Notfound from './components/Notfound.vue'

const router = createRouter({
    history: createWebHistory(),
    routes: [
        { path: '/', component: HelloWorld },
        { path: '/login', component: Login },
        // (\\d+)只能匹配数字
        { path: '/home/:id(\\d+)', component: Home },
        // 匹配 /one, /one/two, /one/two/three, 等
        { path: '/movie/:id+', component: Movie },
        // 匹配 /, /one, /one/two, /one/two/three, 等
        { path: '/about/:id*', component: About },
        { path: '/:pathMatch(.*)*', component: Notfound }
    ]

})

export default router